<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="es.udc.fic.hamNeggs.dao.InputSprint"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>hamNeggs</title>
  <meta name="description" content="">
  <meta name="keywords" content="scrum,agile,project management">
  <meta http-equiv="Content-Type"
 content="text/html; charset=iso-8859-1">
    <style type="text/css">
		<%@ include file="/WEB-INF/css/style.css" %>
		<%@ include file="/WEB-INF/css/data_table_style.css" %>
	</style>
	<script src="jquery-1.4.4.min.js"> </script>
	
	<!-- Load DataTables resources  -->
	<script src="jquery.dataTables.js"> </script>

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
    
<script type="text/javascript">
	$(document).ready(function() {
	    $('#tableData').dataTable();
	} );
	$('#tableData').dataTable( {
        "aaSorting": [[ 1, "desc" ]],
		"sPaginationType": "full_numbers"
    } );
</script>

<script type="text/javascript">
$(function () {
    $('#container').highcharts({
        title: {
            text: 'BurnDown Chart',
            x: -20 //center
        },
        subtitle: {
            text: 'work left to do versus time',
            x: -20
        },
        xAxis: {
            categories: [
						<%
						ArrayList<InputSprint> sprints = (ArrayList<InputSprint>)request.getAttribute("sprints");
						if (sprints != null)
							for (int i = 0; i < sprints.size() ;  i++) {%>
									'<%= sprints.get(i).getName()%>',
						
						<%}%>
                         ]
        },
        yAxis: {
            title: {
                text: 'Story Points'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        tooltip: {
            valueSuffix: ' SP'
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: [{
            name: '<%= session.getAttribute("projectName")%>',
            data: [
					<%
					if (sprints != null)
						for (int i = 0; i < sprints.size() ;  i++) {%>
								<%= sprints.get(i).getSpleft()%>,
					
					<%}%>
                   ]
        }]
    });
});
</script>

</head>
<body>
<div class="page-out">
<div class="page-in">
<div class="page">
<div class="main">
<div class="header">
<div class="header-top">
<h1><span>HamNeggs</span> Scrum App</h1>
</div>
<div class="header-bottom">
<h2>an easy web app for managing<br/>
your scrum projects.</h2>
<br/><br/> <h3> project manager </h3> 
<c:choose>
    <c:when test="${!empty selectedProject}">
			<h3> working in ${selectedProject}.</h3>
    </c:when>
</c:choose>
</div>
<div class="topmenu">
<ul>
  <li
 style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; padding-left: 0px;"><a
 href="WelcomePage"><span>Home</span></a></li>
	<li><a href="ProjectManagement">Project</a></li>
	<li><a href="UserStoriesManagement">User Stories</a></li>
	<li><a href="SprintManagement">Sprints</a></li>
	<li><a href="MeetingManagement">Meetings</a></li>
	<li><a href="Login?action=logout">Logout</a></li>
</ul>
</div>
</div>
<div class="content">
<h2 class="sidebar1">Project Info</h2>
	<h3>Basic Project Data</h3>
	<div id="contentResultsTable">
            <table cellpadding="0" cellspacing="0" border="0" id="table1" class="display">
                <thead>
                    <tr>
                        <th scope="col">Id</th>
                        <th scope="col">Name</th>
                        <th scope="col">Start Date</th>
                        <th scope="col">End Date</th>
                        <th scope="col">Story Points</th>
                    </tr>
                </thead>
                <tbody>                             
                  <tr>
                      <td><c:out value="${project.id}"/></td>
                      <td><c:out value="${project.name}"/></td>
                      <td><c:out value="${project.dateStart}"/></td>
                      <td><c:out value="${project.dateEnd}"/></td>
                      <td><c:out value="${spestimated}"/></td>
                  </tr>	                       
                </tbody>
            </table>
	</div> 
	
	<h3>Project Monitoring Data</h3>
	<div id="contentResultsTable">
            <table cellpadding="0" cellspacing="0" border="0" id="table2" class="display">
                <thead>
	                <tr>
					    <td colspan="3">User Stories</td>
					    <td colspan="3">Story Points</td>
					</tr>
                    <tr>
                        <th scope="col">Registered</th>
                        <th scope="col">Validated</th>
                        <th scope="col">%</th>
                        <th scope="col">Estimated</th>
                        <th scope="col">Done</th>
                        <th scope="col">%</th>
                    </tr>
                </thead>
                <tbody>                             
                  <tr>
                      <td><c:out value="${project.userStories.size()}"/></td>
                      <td><c:out value="${ustdone}"/></td>
                      <td><c:out value="${100*ustdone/project.userStories.size()}"/>%</td>
                      <td><c:out value="${spestimated}"/></td>
                      <td><c:out value="${spdone}"/></td>
                      <td><c:out value="${100*spdone/spestimated}"/>%</td>
                  </tr>	                       
                </tbody>
            </table>
	</div> 
	
	<c:if test="${rol == \"ScrumMaster\" }">
		
		<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
		
		<br/><br/><br/><br/>
		<h3>Project Team</h3>	
			<div id="contentResultsTable">
			<p align="right"><a href="WorkDetails" onclick="javascript:void window.open('WorkDetails','1','width=450,height=450,toolbar=0,menubar=0,location=1,status=1,scrollbars=1,resizable=1,left=0,top=0');return false;"><img src="images/plus.jpeg"/></a></p>
			<br /><br />	
		            <table cellpadding="0" cellspacing="0" border="0" id="tableData" class="display">
		                <thead>
		                    <tr>
		                        <th scope="col">Login</th>
		                        <th scope="col">Name</th>
		                        <th scope="col">Role</th>
	                            <th scope="col">Action</th>
		                    </tr>
		                </thead>
		                <tbody>     
		   					<c:forEach items="${users}" var="user">                        
			                  <tr>
			                      <td><c:out value="${user.name}"/></td>
			                      <td><c:out value="${user.fullName}"/></td>
			                      <td><c:out value="${user.currentRol}"/></td>
	                                  <td>
	                                  	<form action="ProjectManagement" method="post">
											<input type="hidden" name="user" value="${user.id}"/>
			 								<input id="minus" type="submit" name="action" value="Delete"/>
			 							<a href="WorkDetails?id=${user.id}" onclick="javascript:void window.open('WorkDetails?id=${user.id}','2','width=450,height=450,toolbar=0,menubar=0,location=1,status=1,scrollbars=1,resizable=1,left=0,top=0');return false;"><img src="images/edit.jpeg"/></a>
			 							</form>
	                                  </td>
			                  </tr>	  
		                  	</c:forEach>                     
		                </tbody>
		            </table>
			</div>
    </c:if>
</div>
<div class="footer">
<!--DO NOT Remove The Footer Links-->
<a href="http://www.htmltemplates.net">
<img src="images/footer.gif" alt="html templates" border="0" height="1" width="1"></a>
<p>&copy; Copyright 2013. By Estefania Rabadan<br>
</p>
<ul>
  <li style="border-left: medium none;"><a href="index.html"><span>Home</span></a></li>
  <li><a href="#"><span>Contact</span></a></li>
  <li><a href="#"><span>Resources</span></a></li>
  <li style="padding-right: 0px;"><a href="#"><span>Links</span></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

<!-- 
	<c:if test="${rol == \"ScrumMaster\" }"> 
	
    
	
	</c:if> -->